package cc.ilzy.mall.api.controller;

import cc.ilzy.mall.model.pojo.User;
import cc.ilzy.mall.model.request.UserLoginRequest;
import cc.ilzy.mall.model.request.UserRegisterRequest;
import cc.ilzy.mall.utils.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

@Api(value = "用户信息相关接口", tags = "用户信息相关接口")
@RequestMapping("/api/user/v1")
@Validated
public interface IUserController {
    @GetMapping("/getUserInfo/{userId}")
    ApiResponse<User> getUserInfo(@PathVariable Long userId);

    @ApiOperation("上传用户头像")
    @PostMapping("/upload")
    ApiResponse<String> uploadUserAvatar(
            @ApiParam(value = "文件上传", required = true) @RequestParam("file") MultipartFile file);

    @ApiOperation("用户注册操作")
    @PostMapping("/register")
    ApiResponse<Void> registerUser(
            @ApiParam(value = "注册用户信息", required = true) @Valid @RequestBody UserRegisterRequest user);


    @ApiOperation("用户登录操作")
    @PostMapping("/login")
    ApiResponse<Void> login(
            @ApiParam(value = "登录用户信息", required = true) @Valid @RequestBody UserLoginRequest user);
}
